@{
    var isbh = Netnr.Core.CacheTo.Get(GlobalTo.GetValue("Common:BuildHtmlKey")) as bool? ?? false;
}

<div class="container-fluid">
    <div class="row">

        @if (!isbh)
        {
            <div class="col-md-12 mt-3">
                <a href="/build" target="_blank">构建静态HTML</a>
                <a href="/index.html" class="mx-3" target="_blank">访问静态HTML</a>
            </div>
        }

        <div class="col-md-12 mt-3">
            <div class="input-group">
                <div class="input-group-prepend">
                    <select class="custom-select" style="width:150px;" id="seGroup">
                        <option value="">全部</option>
                        @foreach (var gi in NavService.Nav)
                        {
                            <option value="@gi["group"].ToString()">@gi["group"].ToString()</option>
                        }
                    </select>
                </div>
                <div class="input-group-prepend">
                    <button class="btn btn-success" id="btnSearch">搜索</button>
                </div>
                <input type="text" class="form-control" placeholder="双击空白处 重置搜索条件" id="txtSearch">
            </div>
        </div>
    </div>

    <div class="navbox">
        @foreach (var gi in NavService.Nav)
        {
            <div class="row">
                <div class="col-md-12 h5 mt-3"><i class="fa fa-fw text-muted fa-reorder"></i>@gi["group"].ToString()</div>
                @foreach (var item in gi["items"])
                {
                    var href = item["url"].ToString();
                    if (!isbh && !href.Contains("//"))
                    {
                        href = "/home" + href;
                    }
                    var target = item["target"]?.ToString();
                    if (target != null)
                    {
                        target = "target='" + target + "'";
                    }
                    else if (href.Contains("//"))
                    {
                        target = "target='_blank'";
                    }
                    var title = Html.Raw(item["title"].ToString());
                    var remark = Html.Raw(item["remark"]?.ToString() ?? title.ToString());

                    <div class="col-xl-3 col-md-4 col-sm-6 mb-2">
                        <div class="card">
                            <div class="card-body">
                                <a href="@href" @Html.Raw(target)>
                                    <svg><use xlink:href="#@item["icon"].ToString()"></use></svg>
                                    <h5 class="ov">@title</h5>
                                    <small>@remark</small>
                                </a>
                            </div>
                        </div>
                    </div>
                }
            </div>
        }
    </div>
</div>

<script src="/js/index.js" asp-append-version="true"></script>